home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Sound.a < prev    next >
Encoding:
Text File  |  1996-05-29  |  28.8 KB  |  1,038 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Sound.a
  3. ;
  4. ;    Contains:    Sound Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2.1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  21. __SOUND__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  30.     include 'Components.a'
  31.     ENDIF
  32. ;        include 'MixedMode.a'                                        ;
  33.  
  34.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  35.     include 'MixedMode.a'
  36.     ENDIF
  37. ;
  38. ;                        * * *  N O T E  * * *
  39. ;
  40. ;    This file has been updated to include Sound Manager 3.1 interfaces.
  41. ;
  42. ;    Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
  43. ;    that originally shipped with the PowerMacs. These missing functions and the
  44. ;    new 3.2 interfaces have been released in the SoundLib library for PowerPC
  45. ;    developers to link with. The runtime library for these functions are
  46. ;    installed by Sound Manager 3.2. The following functions are found in SoundLib.
  47. ;
  48. ;        GetCompressionInfo, GetSoundPreference, SetSoundPreference,
  49. ;        UnsignedFixedMulDiv, SndGetInfo, SndSetInfo
  50. ;
  51. ;
  52. ;    Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  53. ;
  54. ;    These items are no longer defined, but appear here so that someone
  55. ;    searching the interfaces might find them. If you are using one of these
  56. ;    items, you must change your code to support the Sound Manager.
  57. ;
  58. ;        swMode, ftMode, ffMode
  59. ;        FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  60. ;        SndCompletionProcPtr
  61. ;        StartSound, StopSound, SoundDone
  62. ;
  63.  
  64. soundListRsrc                    EQU        'snd '                ;Resource type used by Sound Manager
  65. rate44khz                        EQU        $AC440000            ;44100.00000 in fixed-point
  66. rate22050hz                        EQU        $56220000            ;22050.00000 in fixed-point
  67. rate22khz                        EQU        $56EE8BA3            ;22254.54545 in fixed-point
  68. rate11khz                        EQU        $2B7745D1            ;11127.27273 in fixed-point
  69. rate11025hz                        EQU        $2B110000            ;11025.00000 in fixed-point
  70. ;synthesizer numbers for SndNewChannel
  71. squareWaveSynth                    EQU        1                    ;square wave synthesizer
  72. waveTableSynth                    EQU        3                    ;wave table synthesizer
  73. sampledSynth                    EQU        5                    ;sampled sound synthesizer
  74. ;old Sound Manager MACE synthesizer numbers
  75. MACE3snthID                        EQU        11
  76. MACE6snthID                        EQU        13
  77. kMiddleC                        EQU        60                    ;MIDI note value for middle C
  78. kSimpleBeepID                    EQU        1                    ;reserved resource ID for Simple Beep
  79. kFullVolume                        EQU        $0100                ;1.0, setting for full hardware output volume
  80. kNoVolume                        EQU        0                    ;setting for no sound volume
  81. ;command numbers for SndDoCommand and SndDoImmediate
  82. nullCmd                            EQU        0
  83. initCmd                            EQU        1
  84. freeCmd                            EQU        2
  85. quietCmd                        EQU        3
  86. flushCmd                        EQU        4
  87. reInitCmd                        EQU        5
  88. waitCmd                            EQU        10
  89. pauseCmd                        EQU        11
  90. resumeCmd                        EQU        12
  91. callBackCmd                        EQU        13
  92.  
  93. syncCmd                            EQU        14
  94. availableCmd                    EQU        24
  95. versionCmd                        EQU        25
  96. totalLoadCmd                    EQU        26
  97. loadCmd                            EQU        27
  98. freqDurationCmd                    EQU        40
  99. restCmd                            EQU        41
  100. freqCmd                            EQU        42
  101. ampCmd                            EQU        43
  102. timbreCmd                        EQU        44
  103. getAmpCmd                        EQU        45
  104. volumeCmd                        EQU        46                    ;sound manager 3.0 or later only
  105. getVolumeCmd                    EQU        47                    ;sound manager 3.0 or later only
  106. waveTableCmd                    EQU        60
  107. phaseCmd                        EQU        61
  108.  
  109. soundCmd                        EQU        80
  110. bufferCmd                        EQU        81
  111. rateCmd                            EQU        82
  112. continueCmd                        EQU        83
  113. doubleBufferCmd                    EQU        84
  114. getRateCmd                        EQU        85
  115. rateMultiplierCmd                EQU        86
  116. getRateMultiplierCmd            EQU        87
  117. sizeCmd                            EQU        90
  118. convertCmd                        EQU        91
  119. stdQLength                        EQU        128
  120. dataOffsetFlag                    EQU        $8000
  121.  
  122. ;channel initialization parameters
  123.     IF OLDROUTINENAMES  THEN
  124. waveInitChannelMask                EQU        $07
  125. waveInitChannel0                EQU        $04                    ;wave table only, Sound Manager 2.0 and earlier
  126. waveInitChannel1                EQU        $05                    ;wave table only, Sound Manager 2.0 and earlier
  127. waveInitChannel2                EQU        $06                    ;wave table only, Sound Manager 2.0 and earlier
  128. waveInitChannel3                EQU        $07                    ;wave table only, Sound Manager 2.0 and earlier
  129. initChan0                        EQU        waveInitChannel0    ;obsolete spelling
  130. initChan1                        EQU        waveInitChannel1    ;obsolete spelling
  131. initChan2                        EQU        waveInitChannel2    ;obsolete spelling
  132. initChan3                        EQU        waveInitChannel3    ;obsolete spelling
  133.  
  134.     ENDIF
  135. initChanLeft                    EQU        $0002                ;left stereo channel
  136. initChanRight                    EQU        $0003                ;right stereo channel
  137. initNoInterp                    EQU        $0004                ;no linear interpolation
  138. initNoDrop                        EQU        $0008                ;no drop-sample conversion
  139. initMono                        EQU        $0080                ;monophonic channel
  140. initStereo                        EQU        $00C0                ;stereo channel
  141. initMACE3                        EQU        $0300                ;MACE 3:1
  142. initMACE6                        EQU        $0400                ;MACE 6:1
  143. initPanMask                        EQU        $0003                ;mask for right/left pan values
  144. initSRateMask                    EQU        $0030                ;mask for sample rate values
  145. initStereoMask                    EQU        $00C0                ;mask for mono/stereo values
  146. initCompMask                    EQU        $FF00                ;mask for compression IDs
  147. kUseOptionalOutputDevice        EQU        -1                    ;only for Sound Manager 3.0 or later
  148. notCompressed                    EQU        0                    ;compression ID's
  149. fixedCompression                EQU        -1                    ;compression ID for fixed-sized compression
  150. variableCompression                EQU        -2                    ;compression ID for variable-sized compression
  151. twoToOne                        EQU        1
  152. eightToThree                    EQU        2
  153. threeToOne                        EQU        3
  154. sixToOne                        EQU        4
  155.  
  156.     IF ¬ GENERATINGPOWERPC  THEN
  157. stdSH                            EQU        $00                    ;Standard sound header encode value
  158. extSH                            EQU        $FF                    ;Extended sound header encode value
  159. cmpSH                            EQU        $FE                    ;Compressed sound header encode value
  160.  
  161.     ENDIF
  162. outsideCmpSH                    EQU        0                    ;obsolete MACE constant
  163. insideCmpSH                        EQU        1                    ;obsolete MACE constant
  164. aceSuccess                        EQU        0                    ;obsolete MACE constant
  165. aceMemFull                        EQU        1                    ;obsolete MACE constant
  166. aceNilBlock                        EQU        2                    ;obsolete MACE constant
  167. aceBadComp                        EQU        3                    ;obsolete MACE constant
  168. aceBadEncode                    EQU        4                    ;obsolete MACE constant
  169. aceBadDest                        EQU        5                    ;obsolete MACE constant
  170. aceBadCmd                        EQU        6                    ;obsolete MACE constant
  171. sixToOnePacketSize                EQU        8
  172. threeToOnePacketSize            EQU        16
  173. stateBlockSize                    EQU        64
  174. leftOverBlockSize                EQU        32
  175. firstSoundFormat                EQU        $0001                ;general sound format
  176. secondSoundFormat                EQU        $0002                ;special sampled sound format (HyperCard)
  177. dbBufferReady                    EQU        $00000001            ;double buffer is filled
  178. dbLastBuffer                    EQU        $00000004            ;last double buffer to play
  179. sysBeepDisable                    EQU        $0000                ;SysBeep() enable flags
  180. sysBeepEnable                    EQU        (1 << 0)
  181. sysBeepSynchronous                EQU        (1 << 1)            ;if bit set, make alert sounds synchronous
  182. unitTypeNoSelection                EQU        $FFFF                ;unitTypes for AudioSelection.unitType
  183. unitTypeSeconds                    EQU        $0000
  184.  
  185. ; unsigned fixed-point number 
  186. ; typedef unsigned long     UnsignedFixed
  187. SndCommand                 RECORD    0
  188. cmd                         ds.w   1        ; offset: $0 (0)
  189. param1                     ds.w   1        ; offset: $2 (2)
  190. param2                     ds.l   1        ; offset: $4 (4)
  191. sizeof                     EQU *            ; size:   $8 (8)
  192.                         ENDR
  193.  
  194. ; typedef struct SndCommand  SndCommand
  195. ; typedef struct SndChannel  SndChannel
  196. ; typedef SndChannel         *SndChannelPtr
  197. SndChannel                 RECORD    0
  198. nextChan                 ds.l   1        ; offset: $0 (0)
  199. firstMod                 ds.l   1        ; offset: $4 (4)        ; reserved for the Sound Manager 
  200. callBack                 ds.l   1        ; offset: $8 (8)
  201. userInfo                 ds.l   1        ; offset: $C (12)
  202. wait                     ds.l   1        ; offset: $10 (16)        ; The following is for internal Sound Manager use only.
  203. cmdInProgress             ds     SndCommand ; offset: $14 (20)
  204. flags                     ds.w   1        ; offset: $1C (28)
  205. qLength                     ds.w   1        ; offset: $1E (30)
  206. qHead                     ds.w   1        ; offset: $20 (32)
  207. qTail                     ds.w   1        ; offset: $22 (34)
  208. queue                     ds.b   128 * SndCommand.sizeof ; offset: $24 (36)
  209. sizeof                     EQU *            ; size:   $424 (1060)
  210.                         ENDR
  211.  
  212. ;MACE structures
  213. StateBlock                 RECORD    0
  214. stateVar                 ds.w   64        ; offset: $0 (0)
  215. sizeof                     EQU *            ; size:   $80 (128)
  216.                         ENDR
  217.  
  218. ; typedef struct StateBlock  StateBlock
  219. ; typedef StateBlock         *StateBlockPtr
  220. LeftOverBlock             RECORD    0
  221. count                     ds.l   1        ; offset: $0 (0)
  222. sampleArea                 ds.b   32        ; offset: $4 (4)
  223. sizeof                     EQU *            ; size:   $24 (36)
  224.                         ENDR
  225.  
  226. ; typedef struct LeftOverBlock  LeftOverBlock
  227. ; typedef LeftOverBlock     *LeftOverBlockPtr
  228. ModRef                     RECORD    0
  229. modNumber                 ds.w   1        ; offset: $0 (0)
  230. modInit                     ds.l   1        ; offset: $2 (2)
  231. sizeof                     EQU *            ; size:   $6 (6)
  232.                         ENDR
  233.  
  234. ; typedef struct ModRef     ModRef
  235. SndListResource         RECORD    0
  236. format                     ds.w   1        ; offset: $0 (0)
  237. numModifiers             ds.w   1        ; offset: $2 (2)
  238. modifierPart             ds     ModRef    ; offset: $4 (4)        ;This is a variable length array
  239. numCommands                 ds.w   1        ; offset: $A (10)
  240. commandPart                 ds     SndCommand ; offset: $C (12)    ;This is a variable length array
  241. dataPart                 ds.b   1        ; offset: $14 (20)        ;This is a variable length array
  242.                          ORG 22
  243. sizeof                     EQU *            ; size:   $16 (22)
  244.                         ENDR
  245.  
  246. ; typedef struct SndListResource  SndListResource
  247. ; typedef SndListResource     *SndListPtr
  248. ; typedef SndListPtr         *SndListHndl, *SndListHandle
  249. ;HyperCard sound resource format
  250. Snd2ListResource         RECORD    0
  251. format                     ds.w   1        ; offset: $0 (0)
  252. refCount                 ds.w   1        ; offset: $2 (2)
  253. numCommands                 ds.w   1        ; offset: $4 (4)
  254. commandPart                 ds     SndCommand ; offset: $6 (6)        ;This is a variable length array
  255. dataPart                 ds.b   1        ; offset: $E (14)        ;This is a variable length array
  256.                          ORG 16
  257. sizeof                     EQU *            ; size:   $10 (16)
  258.                         ENDR
  259.  
  260. ; typedef struct Snd2ListResource  Snd2ListResource
  261. ; typedef Snd2ListResource     *Snd2ListPtr
  262. ; typedef Snd2ListPtr         *Snd2ListHndl, *Snd2ListHandle
  263. SoundHeader             RECORD    0
  264. samplePtr                 ds.l   1        ; offset: $0 (0)        ;if NIL then samples are in sampleArea
  265. length                     ds.l   1        ; offset: $4 (4)        ;length of sound in bytes
  266. sampleRate                 ds.l   1        ; offset: $8 (8)        ;sample rate for this sound
  267. loopStart                 ds.l   1        ; offset: $C (12)        ;start of looping portion
  268. loopEnd                     ds.l   1        ; offset: $10 (16)        ;end of looping portion
  269. encode                     ds.b   1        ; offset: $14 (20)        ;header encoding
  270. baseFrequency             ds.b   1        ; offset: $15 (21)        ;baseFrequency value
  271. sampleArea                 ds.b   1        ; offset: $16 (22)        ;space for when samples follow directly
  272.                          ORG 24
  273. sizeof                     EQU *            ; size:   $18 (24)
  274.                         ENDR
  275.  
  276. ; typedef struct SoundHeader  SoundHeader
  277. ; typedef SoundHeader         *SoundHeaderPtr
  278. CmpSoundHeader             RECORD    0
  279. samplePtr                 ds.l   1        ; offset: $0 (0)        ;if nil then samples are in sample area
  280. numChannels                 ds.l   1        ; offset: $4 (4)        ;number of channels i.e. mono = 1
  281. sampleRate                 ds.l   1        ; offset: $8 (8)        ;sample rate in Apples Fixed point representation
  282. loopStart                 ds.l   1        ; offset: $C (12)        ;loopStart of sound before compression
  283. loopEnd                     ds.l   1        ; offset: $10 (16)        ;loopEnd of sound before compression
  284. encode                     ds.b   1        ; offset: $14 (20)        ;data structure used , stdSH, extSH, or cmpSH
  285. baseFrequency             ds.b   1        ; offset: $15 (21)        ;same meaning as regular SoundHeader
  286. numFrames                 ds.l   1        ; offset: $16 (22)        ;length in frames ( packetFrames or sampleFrames )
  287. AIFFSampleRate             ds.w   5        ; offset: $1A (26)        ;IEEE sample rate
  288. markerChunk                 ds.l   1        ; offset: $24 (36)        ;sync track
  289. format                     ds.l   1        ; offset: $28 (40)        ;data format type, was futureUse1
  290. futureUse2                 ds.l   1        ; offset: $2C (44)        ;reserved by Apple
  291. stateVars                 ds.l   1        ; offset: $30 (48)        ;pointer to State Block
  292. leftOverSamples             ds.l   1        ; offset: $34 (52)        ;used to save truncated samples between compression calls
  293. compressionID             ds.w   1        ; offset: $38 (56)        ;0 means no compression, non zero means compressionID
  294. packetSize                 ds.w   1        ; offset: $3A (58)        ;number of bits in compressed sample packet
  295. snthID                     ds.w   1        ; offset: $3C (60)        ;resource ID of Sound Manager snth that contains NRT C/E
  296. sampleSize                 ds.w   1        ; offset: $3E (62)        ;number of bits in non-compressed sample
  297. sampleArea                 ds.b   1        ; offset: $40 (64)        ;space for when samples follow directly
  298.                          ORG 66
  299. sizeof                     EQU *            ; size:   $42 (66)
  300.                         ENDR
  301.  
  302. ; typedef struct CmpSoundHeader  CmpSoundHeader
  303. ; typedef CmpSoundHeader     *CmpSoundHeaderPtr
  304. ExtSoundHeader             RECORD    0
  305. samplePtr                 ds.l   1        ; offset: $0 (0)        ;if nil then samples are in sample area
  306. numChannels                 ds.l   1        ; offset: $4 (4)        ;number of channels,  ie mono = 1
  307. sampleRate                 ds.l   1        ; offset: $8 (8)        ;sample rate in Apples Fixed point representation
  308. loopStart                 ds.l   1        ; offset: $C (12)        ;same meaning as regular SoundHeader
  309. loopEnd                     ds.l   1        ; offset: $10 (16)        ;same meaning as regular SoundHeader
  310. encode                     ds.b   1        ; offset: $14 (20)        ;data structure used , stdSH, extSH, or cmpSH
  311. baseFrequency             ds.b   1        ; offset: $15 (21)        ;same meaning as regular SoundHeader
  312. numFrames                 ds.l   1        ; offset: $16 (22)        ;length in total number of frames
  313. AIFFSampleRate             ds.w   5        ; offset: $1A (26)        ;IEEE sample rate
  314. markerChunk                 ds.l   1        ; offset: $24 (36)        ;sync track
  315. instrumentChunks         ds.l   1        ; offset: $28 (40)        ;AIFF instrument chunks
  316. AESRecording             ds.l   1        ; offset: $2C (44)
  317. sampleSize                 ds.w   1        ; offset: $30 (48)        ;number of bits in sample
  318. futureUse1                 ds.w   1        ; offset: $32 (50)        ;reserved by Apple
  319. futureUse2                 ds.l   1        ; offset: $34 (52)        ;reserved by Apple
  320. futureUse3                 ds.l   1        ; offset: $38 (56)        ;reserved by Apple
  321. futureUse4                 ds.l   1        ; offset: $3C (60)        ;reserved by Apple
  322. sampleArea                 ds.b   1        ; offset: $40 (64)        ;space for when samples follow directly
  323.                          ORG 66
  324. sizeof                     EQU *            ; size:   $42 (66)
  325.                         ENDR
  326.  
  327. ; typedef struct ExtSoundHeader  ExtSoundHeader
  328. ; typedef ExtSoundHeader     *ExtSoundHeaderPtr
  329. ConversionBlock         RECORD    0
  330. destination                 ds.w   1        ; offset: $0 (0)
  331. unused                     ds.w   1        ; offset: $2 (2)
  332. inputPtr                 ds.l   1        ; offset: $4 (4)
  333. outputPtr                 ds.l   1        ; offset: $8 (8)
  334. sizeof                     EQU *            ; size:   $C (12)
  335.                         ENDR
  336.  
  337. ; typedef struct ConversionBlock  ConversionBlock
  338. ; typedef ConversionBlock     *ConversionBlockPtr
  339. SMStatus                 RECORD    0
  340. smMaxCPULoad             ds.w   1        ; offset: $0 (0)
  341. smNumChannels             ds.w   1        ; offset: $2 (2)
  342. smCurCPULoad             ds.w   1        ; offset: $4 (4)
  343. sizeof                     EQU *            ; size:   $6 (6)
  344.                         ENDR
  345.  
  346. ; typedef struct SMStatus     SMStatus
  347. ; typedef SMStatus             *SMStatusPtr
  348. SCStatus                 RECORD    0
  349. scStartTime                 ds.l   1        ; offset: $0 (0)
  350. scEndTime                 ds.l   1        ; offset: $4 (4)
  351. scCurrentTime             ds.l   1        ; offset: $8 (8)
  352. scChannelBusy             ds.b   1        ; offset: $C (12)
  353. scChannelDisposed         ds.b   1        ; offset: $D (13)
  354. scChannelPaused             ds.b   1        ; offset: $E (14)
  355. scUnused                 ds.b   1        ; offset: $F (15)
  356. scChannelAttributes         ds.l   1        ; offset: $10 (16)
  357. scCPULoad                 ds.l   1        ; offset: $14 (20)
  358. sizeof                     EQU *            ; size:   $18 (24)
  359.                         ENDR
  360.  
  361. ; typedef struct SCStatus     SCStatus
  362. ; typedef SCStatus             *SCStatusPtr
  363. AudioSelection             RECORD    0
  364. unitType                 ds.l   1        ; offset: $0 (0)
  365. selStart                 ds.l   1        ; offset: $4 (4)
  366. selEnd                     ds.l   1        ; offset: $8 (8)
  367. sizeof                     EQU *            ; size:   $C (12)
  368.                         ENDR
  369.  
  370. ; typedef struct AudioSelection  AudioSelection
  371. ; typedef AudioSelection     *AudioSelectionPtr
  372. SndDoubleBuffer         RECORD    0
  373. dbNumFrames                 ds.l   1        ; offset: $0 (0)
  374. dbFlags                     ds.l   1        ; offset: $4 (4)
  375. dbUserInfo                 ds.l   2        ; offset: $8 (8)
  376. dbSoundData                 ds.b   1        ; offset: $10 (16)
  377.                          ORG 18
  378. sizeof                     EQU *            ; size:   $12 (18)
  379.                         ENDR
  380.  
  381. ; typedef struct SndDoubleBuffer  SndDoubleBuffer
  382. ; typedef SndDoubleBuffer     *SndDoubleBufferPtr
  383. SndDoubleBufferHeader     RECORD    0
  384. dbhNumChannels             ds.w   1        ; offset: $0 (0)
  385. dbhSampleSize             ds.w   1        ; offset: $2 (2)
  386. dbhCompressionID         ds.w   1        ; offset: $4 (4)
  387. dbhPacketSize             ds.w   1        ; offset: $6 (6)
  388. dbhSampleRate             ds.l   1        ; offset: $8 (8)
  389. dbhBufferPtr             ds.l   2        ; offset: $C (12)
  390. dbhDoubleBack             ds.l   1        ; offset: $14 (20)
  391. sizeof                     EQU *            ; size:   $18 (24)
  392.                         ENDR
  393.  
  394. ; typedef struct SndDoubleBufferHeader  SndDoubleBufferHeader
  395. ; typedef SndDoubleBufferHeader  *SndDoubleBufferHeaderPtr
  396. SndDoubleBufferHeader2     RECORD    0
  397. dbhNumChannels             ds.w   1        ; offset: $0 (0)
  398. dbhSampleSize             ds.w   1        ; offset: $2 (2)
  399. dbhCompressionID         ds.w   1        ; offset: $4 (4)
  400. dbhPacketSize             ds.w   1        ; offset: $6 (6)
  401. dbhSampleRate             ds.l   1        ; offset: $8 (8)
  402. dbhBufferPtr             ds.l   2        ; offset: $C (12)
  403. dbhDoubleBack             ds.l   1        ; offset: $14 (20)
  404. dbhFormat                 ds.l   1        ; offset: $18 (24)
  405. sizeof                     EQU *            ; size:   $1C (28)
  406.                         ENDR
  407.  
  408. ; typedef struct SndDoubleBufferHeader2  SndDoubleBufferHeader2
  409. ; typedef SndDoubleBufferHeader2  *SndDoubleBufferHeader2Ptr
  410. SoundInfoList             RECORD    0
  411. count                     ds.w   1        ; offset: $0 (0)
  412. infoHandle                 ds.l   1        ; offset: $2 (2)
  413. sizeof                     EQU *            ; size:   $6 (6)
  414.                         ENDR
  415.  
  416. ; typedef struct SoundInfoList  SoundInfoList
  417. ; typedef struct SoundInfoList *        SoundInfoListPtr
  418.  
  419. SoundComponentData        RECORD 0
  420. flags                     ds.l    1        ; offset: $0 (0)
  421. format                     ds.l    1        ; offset: $4 (4)
  422. numChannels                 ds.w    1        ; offset: $8 (8)
  423. sampleSize                 ds.w    1        ; offset: $A (10)
  424. sampleRate                 ds.l    1        ; offset: $C (12)
  425. sampleCount                 ds.l    1        ; offset: $10 (16)
  426. buffer                     ds.l    1        ; offset: $14 (20)
  427. reserved                 ds.l    1        ; offset: $18 (24)
  428. sizeof                     EQU *            ; size:   $1C (28)
  429.                         ENDR
  430. ; typedef struct SoundComponentData *    SoundComponentDataPtr
  431.  
  432. CompressionInfo         RECORD    0
  433. recordSize                 ds.l   1        ; offset: $0 (0)
  434. format                     ds.l   1        ; offset: $4 (4)
  435. compressionID             ds.w   1        ; offset: $8 (8)
  436. samplesPerPacket         ds.w   1        ; offset: $A (10)
  437. bytesPerPacket             ds.w   1        ; offset: $C (12)
  438. bytesPerFrame             ds.w   1        ; offset: $E (14)
  439. bytesPerSample             ds.w   1        ; offset: $10 (16)
  440. futureUse1                 ds.w   1        ; offset: $12 (18)
  441. sizeof                     EQU *            ; size:   $14 (20)
  442.                         ENDR
  443.  
  444. ; typedef struct CompressionInfo  CompressionInfo
  445. ; typedef CompressionInfo     *CompressionInfoPtr
  446. ; typedef CompressionInfoPtr  *CompressionInfoHandle
  447. ; These two routines for Get/SetSoundVol should no longer be used.
  448. ; They were for old Apple Sound Chip machines, and do not support the DSP or PowerMacs.
  449. ; Use Get/SetDefaultOutputVolume instead, if you must change the user's machine.
  450.     IF OLDROUTINENAMES  ** ¬ GENERATINGCFM  THEN
  451. ;
  452. ; pascal void SetSoundVol(short level)
  453. ;
  454.     IF GENERATINGCFM THEN
  455.         IMPORT_CFM_FUNCTION    SetSoundVol
  456.     ENDIF
  457.  
  458. ;
  459. ; pascal void GetSoundVol(short *level)
  460. ;
  461.     IF ¬ GENERATINGCFM THEN
  462.         ; parameters: 
  463.         ;     level             => A0
  464.         Macro
  465.         _GetSoundVol
  466.             dc.w     $4218
  467.             dc.w     $10B8
  468.             dc.w     $0260
  469.         EndM
  470.     ELSE
  471.         IMPORT_CFM_FUNCTION    GetSoundVol
  472.     ENDIF
  473.  
  474.     ENDIF
  475. ;
  476. ; pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  477. ;
  478.     IF ¬ GENERATINGCFM THEN
  479.         _SndDoCommand:    OPWORD    $A803
  480.     ELSE
  481.         IMPORT_CFM_FUNCTION    SndDoCommand
  482.     ENDIF
  483.  
  484. ;
  485. ; pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  486. ;
  487.     IF ¬ GENERATINGCFM THEN
  488.         _SndDoImmediate:    OPWORD    $A804
  489.     ELSE
  490.         IMPORT_CFM_FUNCTION    SndDoImmediate
  491.     ENDIF
  492.  
  493. ;
  494. ; pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  495. ;
  496.     IF ¬ GENERATINGCFM THEN
  497.         _SndNewChannel:    OPWORD    $A807
  498.     ELSE
  499.         IMPORT_CFM_FUNCTION    SndNewChannel
  500.     ENDIF
  501.  
  502. ;
  503. ; pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  504. ;
  505.     IF ¬ GENERATINGCFM THEN
  506.         _SndDisposeChannel:    OPWORD    $A801
  507.     ELSE
  508.         IMPORT_CFM_FUNCTION    SndDisposeChannel
  509.     ENDIF
  510.  
  511. ;
  512. ; pascal OSErr SndPlay(SndChannelPtr chan, SndListHandle sndHdl, Boolean async)
  513. ;
  514.     IF ¬ GENERATINGCFM THEN
  515.         _SndPlay:    OPWORD    $A805
  516.     ELSE
  517.         IMPORT_CFM_FUNCTION    SndPlay
  518.     ENDIF
  519.  
  520.     IF OLDROUTINENAMES  THEN
  521. ;
  522. ; pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  523. ;
  524.     IF ¬ GENERATINGCFM THEN
  525.         _SndAddModifier:    OPWORD    $A802
  526.     ELSE
  527.         IMPORT_CFM_FUNCTION    SndAddModifier
  528.     ENDIF
  529.  
  530.     ENDIF
  531. ;
  532. ; pascal OSErr SndControl(short id, SndCommand *cmd)
  533. ;
  534.     IF ¬ GENERATINGCFM THEN
  535.         _SndControl:    OPWORD    $A806
  536.     ELSE
  537.         IMPORT_CFM_FUNCTION    SndControl
  538.     ENDIF
  539.  
  540. ; Sound Manager 2.0 and later, uses _SoundDispatch 
  541. ;
  542. ; pascal NumVersion SndSoundManagerVersion(void)
  543. ;
  544.     IF ¬ GENERATINGCFM THEN
  545.         Macro
  546.         _SndSoundManagerVersion
  547.             dc.w     $203C
  548.             dc.w     $000C
  549.             dc.w     $0008
  550.             dc.w     $A800
  551.         EndM
  552.     ELSE
  553.         IMPORT_CFM_FUNCTION    SndSoundManagerVersion
  554.     ENDIF
  555.  
  556. ;
  557. ; pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  558. ;
  559.     IF ¬ GENERATINGCFM THEN
  560.         Macro
  561.         _SndStartFilePlay
  562.             dc.w     $203C
  563.             dc.w     $0D00
  564.             dc.w     $0008
  565.             dc.w     $A800
  566.         EndM
  567.     ELSE
  568.         IMPORT_CFM_FUNCTION    SndStartFilePlay
  569.     ENDIF
  570.  
  571. ;
  572. ; pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  573. ;
  574.     IF ¬ GENERATINGCFM THEN
  575.         Macro
  576.         _SndPauseFilePlay
  577.             dc.w     $203C
  578.             dc.w     $0204
  579.             dc.w     $0008
  580.             dc.w     $A800
  581.         EndM
  582.     ELSE
  583.         IMPORT_CFM_FUNCTION    SndPauseFilePlay
  584.     ENDIF
  585.  
  586. ;
  587. ; pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  588. ;
  589.     IF ¬ GENERATINGCFM THEN
  590.         Macro
  591.         _SndStopFilePlay
  592.             dc.w     $203C
  593.             dc.w     $0308
  594.             dc.w     $0008
  595.             dc.w     $A800
  596.         EndM
  597.     ELSE
  598.         IMPORT_CFM_FUNCTION    SndStopFilePlay
  599.     ENDIF
  600.  
  601. ;
  602. ; pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  603. ;
  604.     IF ¬ GENERATINGCFM THEN
  605.         Macro
  606.         _SndChannelStatus
  607.             dc.w     $203C
  608.             dc.w     $0510
  609.             dc.w     $0008
  610.             dc.w     $A800
  611.         EndM
  612.     ELSE
  613.         IMPORT_CFM_FUNCTION    SndChannelStatus
  614.     ENDIF
  615.  
  616. ;
  617. ; pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  618. ;
  619.     IF ¬ GENERATINGCFM THEN
  620.         Macro
  621.         _SndManagerStatus
  622.             dc.w     $203C
  623.             dc.w     $0314
  624.             dc.w     $0008
  625.             dc.w     $A800
  626.         EndM
  627.     ELSE
  628.         IMPORT_CFM_FUNCTION    SndManagerStatus
  629.     ENDIF
  630.  
  631. ;
  632. ; pascal void SndGetSysBeepState(short *sysBeepState)
  633. ;
  634.     IF ¬ GENERATINGCFM THEN
  635.         Macro
  636.         _SndGetSysBeepState
  637.             dc.w     $203C
  638.             dc.w     $0218
  639.             dc.w     $0008
  640.             dc.w     $A800
  641.         EndM
  642.     ELSE
  643.         IMPORT_CFM_FUNCTION    SndGetSysBeepState
  644.     ENDIF
  645.  
  646. ;
  647. ; pascal OSErr SndSetSysBeepState(short sysBeepState)
  648. ;
  649.     IF ¬ GENERATINGCFM THEN
  650.         Macro
  651.         _SndSetSysBeepState
  652.             dc.w     $203C
  653.             dc.w     $011C
  654.             dc.w     $0008
  655.             dc.w     $A800
  656.         EndM
  657.     ELSE
  658.         IMPORT_CFM_FUNCTION    SndSetSysBeepState
  659.     ENDIF
  660.  
  661. ;
  662. ; pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  663. ;
  664.     IF ¬ GENERATINGCFM THEN
  665.         Macro
  666.         _SndPlayDoubleBuffer
  667.             dc.w     $203C
  668.             dc.w     $0420
  669.             dc.w     $0008
  670.             dc.w     $A800
  671.         EndM
  672.     ELSE
  673.         IMPORT_CFM_FUNCTION    SndPlayDoubleBuffer
  674.     ENDIF
  675.  
  676. ; MACE compression routines 
  677. ;
  678. ; pascal NumVersion MACEVersion(void)
  679. ;
  680.     IF ¬ GENERATINGCFM THEN
  681.         Macro
  682.         _MACEVersion
  683.             dc.w     $203C
  684.             dc.w     $0000
  685.             dc.w     $0010
  686.             dc.w     $A800
  687.         EndM
  688.     ELSE
  689.         IMPORT_CFM_FUNCTION    MACEVersion
  690.     ENDIF
  691.  
  692. ;
  693. ; pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  694. ;
  695.     IF ¬ GENERATINGCFM THEN
  696.         Macro
  697.         _Comp3to1
  698.             dc.w     $203C
  699.             dc.w     $0004
  700.             dc.w     $0010
  701.             dc.w     $A800
  702.         EndM
  703.     ELSE
  704.         IMPORT_CFM_FUNCTION    Comp3to1
  705.     ENDIF
  706.  
  707. ;
  708. ; pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  709. ;
  710.     IF ¬ GENERATINGCFM THEN
  711.         Macro
  712.         _Exp1to3
  713.             dc.w     $203C
  714.             dc.w     $0008
  715.             dc.w     $0010
  716.             dc.w     $A800
  717.         EndM
  718.     ELSE
  719.         IMPORT_CFM_FUNCTION    Exp1to3
  720.     ENDIF
  721.  
  722. ;
  723. ; pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  724. ;
  725.     IF ¬ GENERATINGCFM THEN
  726.         Macro
  727.         _Comp6to1
  728.             dc.w     $203C
  729.             dc.w     $000C
  730.             dc.w     $0010
  731.             dc.w     $A800
  732.         EndM
  733.     ELSE
  734.         IMPORT_CFM_FUNCTION    Comp6to1
  735.     ENDIF
  736.  
  737. ;
  738. ; pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  739. ;
  740.     IF ¬ GENERATINGCFM THEN
  741.         Macro
  742.         _Exp1to6
  743.             dc.w     $203C
  744.             dc.w     $0010
  745.             dc.w     $0010
  746.             dc.w     $A800
  747.         EndM
  748.     ELSE
  749.         IMPORT_CFM_FUNCTION    Exp1to6
  750.     ENDIF
  751.  
  752. ; Sound Manager 3.0 and later calls 
  753. ;
  754. ; pascal OSErr GetSysBeepVolume(long *level)
  755. ;
  756.     IF ¬ GENERATINGCFM THEN
  757.         Macro
  758.         _GetSysBeepVolume
  759.             dc.w     $203C
  760.             dc.w     $0224
  761.             dc.w     $0018
  762.             dc.w     $A800
  763.         EndM
  764.     ELSE
  765.         IMPORT_CFM_FUNCTION    GetSysBeepVolume
  766.     ENDIF
  767.  
  768. ;
  769. ; pascal OSErr SetSysBeepVolume(long level)
  770. ;
  771.     IF ¬ GENERATINGCFM THEN
  772.         Macro
  773.         _SetSysBeepVolume
  774.             dc.w     $203C
  775.             dc.w     $0228
  776.             dc.w     $0018
  777.             dc.w     $A800
  778.         EndM
  779.     ELSE
  780.         IMPORT_CFM_FUNCTION    SetSysBeepVolume
  781.     ENDIF
  782.  
  783. ;
  784. ; pascal OSErr GetDefaultOutputVolume(long *level)
  785. ;
  786.     IF ¬ GENERATINGCFM THEN
  787.         Macro
  788.         _GetDefaultOutputVolume
  789.             dc.w     $203C
  790.             dc.w     $022C
  791.             dc.w     $0018
  792.             dc.w     $A800
  793.         EndM
  794.     ELSE
  795.         IMPORT_CFM_FUNCTION    GetDefaultOutputVolume
  796.     ENDIF
  797.  
  798. ;
  799. ; pascal OSErr SetDefaultOutputVolume(long level)
  800. ;
  801.     IF ¬ GENERATINGCFM THEN
  802.         Macro
  803.         _SetDefaultOutputVolume
  804.             dc.w     $203C
  805.             dc.w     $0230
  806.             dc.w     $0018
  807.             dc.w     $A800
  808.         EndM
  809.     ELSE
  810.         IMPORT_CFM_FUNCTION    SetDefaultOutputVolume
  811.     ENDIF
  812.  
  813. ;
  814. ; pascal OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long *offset)
  815. ;
  816.     IF ¬ GENERATINGCFM THEN
  817.         Macro
  818.         _GetSoundHeaderOffset
  819.             dc.w     $203C
  820.             dc.w     $0404
  821.             dc.w     $0018
  822.             dc.w     $A800
  823.         EndM
  824.     ELSE
  825.         IMPORT_CFM_FUNCTION    GetSoundHeaderOffset
  826.     ENDIF
  827.  
  828. ;
  829. ; pascal UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  830. ;
  831.     IF ¬ GENERATINGCFM THEN
  832.         Macro
  833.         _UnsignedFixedMulDiv
  834.             dc.w     $203C
  835.             dc.w     $060C
  836.             dc.w     $0018
  837.             dc.w     $A800
  838.         EndM
  839.     ELSE
  840.         IMPORT_CFM_FUNCTION    UnsignedFixedMulDiv
  841.     ENDIF
  842.  
  843. ;
  844. ; pascal OSErr GetCompressionInfo(short compressionID, OSType format, short numChannels, short sampleSize, CompressionInfoPtr cp)
  845. ;
  846.     IF ¬ GENERATINGCFM THEN
  847.         Macro
  848.         _GetCompressionInfo
  849.             dc.w     $203C
  850.             dc.w     $0710
  851.             dc.w     $0018
  852.             dc.w     $A800
  853.         EndM
  854.     ELSE
  855.         IMPORT_CFM_FUNCTION    GetCompressionInfo
  856.     ENDIF
  857.  
  858. ;
  859. ; pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  860. ;
  861.     IF ¬ GENERATINGCFM THEN
  862.         Macro
  863.         _SetSoundPreference
  864.             dc.w     $203C
  865.             dc.w     $0634
  866.             dc.w     $0018
  867.             dc.w     $A800
  868.         EndM
  869.     ELSE
  870.         IMPORT_CFM_FUNCTION    SetSoundPreference
  871.     ENDIF
  872.  
  873. ;
  874. ; pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  875. ;
  876.     IF ¬ GENERATINGCFM THEN
  877.         Macro
  878.         _GetSoundPreference
  879.             dc.w     $203C
  880.             dc.w     $0638
  881.             dc.w     $0018
  882.             dc.w     $A800
  883.         EndM
  884.     ELSE
  885.         IMPORT_CFM_FUNCTION    GetSoundPreference
  886.     ENDIF
  887.  
  888. ; Sound Manager 3.1 and later calls 
  889. ;
  890. ; pascal OSErr SndGetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  891. ;
  892.     IF ¬ GENERATINGCFM THEN
  893.         Macro
  894.         _SndGetInfo
  895.             dc.w     $203C
  896.             dc.w     $063C
  897.             dc.w     $0018
  898.             dc.w     $A800
  899.         EndM
  900.     ELSE
  901.         IMPORT_CFM_FUNCTION    SndGetInfo
  902.     ENDIF
  903.  
  904. ;
  905. ; pascal OSErr SndSetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  906. ;
  907.     IF ¬ GENERATINGCFM THEN
  908.         Macro
  909.         _SndSetInfo
  910.             dc.w     $203C
  911.             dc.w     $0640
  912.             dc.w     $0018
  913.             dc.w     $A800
  914.         EndM
  915.     ELSE
  916.         IMPORT_CFM_FUNCTION    SndSetInfo
  917.     ENDIF
  918.  
  919. ;
  920. ; pascal OSErr GetSoundOutputInfo(Component outputDevice, OSType selector, void *infoPtr)
  921. ;
  922.     IF ¬ GENERATINGCFM THEN
  923.         Macro
  924.         _GetSoundOutputInfo
  925.             move.l              #$06440018,D0
  926.             dc.w                $A800
  927.         EndM
  928.     ELSE
  929.         IMPORT_CFM_FUNCTION GetSoundOutputInfo
  930.     ENDIF
  931.  
  932. ;
  933. ; pascal OSErr SetSoundOutputInfo(Component outputDevice, OSType selector, const void *infoPtr)
  934. ;
  935.     IF ¬ GENERATINGCFM THEN
  936.         Macro
  937.         _SetSoundOutputInfo
  938.             move.l              #$06480018,D0
  939.             dc.w                $A800
  940.         EndM
  941.     ELSE
  942.         IMPORT_CFM_FUNCTION SetSoundOutputInfo
  943.     ENDIF
  944.  
  945. ;  Sound Manager 3.2 and later calls 
  946. ;
  947. ; pascal OSErr GetCompressionName(OSType compressionType, Str255 compressionName)
  948. ;
  949.     IF ¬ GENERATINGCFM THEN
  950.         Macro
  951.         _GetCompressionName
  952.             move.l              #$044C0018,D0
  953.             dc.w                $A800
  954.         EndM
  955.     ELSE
  956.         IMPORT_CFM_FUNCTION GetCompressionName
  957.     ENDIF
  958.  
  959. ;
  960. ; pascal OSErr SoundConverterOpen(const SoundComponentData *inputFormat, const SoundComponentData *outputFormat, SoundConverter *sc)
  961. ;
  962.     IF ¬ GENERATINGCFM THEN
  963.         Macro
  964.         _SoundConverterOpen
  965.             move.l              #$06500018,D0
  966.             dc.w                $A800
  967.         EndM
  968.     ELSE
  969.         IMPORT_CFM_FUNCTION SoundConverterOpen
  970.     ENDIF
  971.  
  972. ;
  973. ; pascal OSErr SoundConverterClose(SoundConverter sc)
  974. ;
  975.     IF ¬ GENERATINGCFM THEN
  976.         Macro
  977.         _SoundConverterClose
  978.             move.l              #$02540018,D0
  979.             dc.w                $A800
  980.         EndM
  981.     ELSE
  982.         IMPORT_CFM_FUNCTION SoundConverterClose
  983.     ENDIF
  984.  
  985. ;
  986. ; pascal OSErr SoundConverterGetBufferSizes(SoundConverter sc, unsigned long inputBytesTarget, unsigned long *inputFrames, unsigned long *inputBytes, unsigned long *outputBytes)
  987. ;
  988.     IF ¬ GENERATINGCFM THEN
  989.         Macro
  990.         _SoundConverterGetBufferSizes
  991.             move.l              #$0A580018,D0
  992.             dc.w                $A800
  993.         EndM
  994.     ELSE
  995.         IMPORT_CFM_FUNCTION SoundConverterGetBufferSizes
  996.     ENDIF
  997.  
  998. ;
  999. ; pascal OSErr SoundConverterBeginConversion(SoundConverter sc)
  1000. ;
  1001.     IF ¬ GENERATINGCFM THEN
  1002.         Macro
  1003.         _SoundConverterBeginConversion
  1004.             move.l              #$025C0018,D0
  1005.             dc.w                $A800
  1006.         EndM
  1007.     ELSE
  1008.         IMPORT_CFM_FUNCTION SoundConverterBeginConversion
  1009.     ENDIF
  1010.  
  1011. ;
  1012. ; pascal OSErr SoundConverterConvertBuffer(SoundConverter sc, const void *inputPtr, unsigned long inputFrames, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes)
  1013. ;
  1014.     IF ¬ GENERATINGCFM THEN
  1015.         Macro
  1016.         _SoundConverterConvertBuffer
  1017.             move.l              #$0C600018,D0
  1018.             dc.w                $A800
  1019.         EndM
  1020.     ELSE
  1021.         IMPORT_CFM_FUNCTION SoundConverterConvertBuffer
  1022.     ENDIF
  1023.  
  1024. ;
  1025. ; pascal OSErr SoundConverterEndConversion(SoundConverter sc, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes)
  1026. ;
  1027.     IF ¬ GENERATINGCFM THEN
  1028.         Macro
  1029.         _SoundConverterEndConversion
  1030.             move.l              #$08640018,D0
  1031.             dc.w                $A800
  1032.         EndM
  1033.     ELSE
  1034.         IMPORT_CFM_FUNCTION SoundConverterEndConversion
  1035.     ENDIF
  1036.  
  1037.     ENDIF ; __SOUND__ 
  1038.